var InteractiveTable = Base.extend({

    _tableContainer: null,
    _validationRules: null,

    constructor: function(validationRules)
    {
        this._tableContainer = $('#inventoryTableContainer');
        this._validationRules = validationRules;
        this._initFormRows();
    },

    _initFormRows: function()
    {
        var thisPtr = this;
        $('.form_row').each(function(){
            var formRow = new FormRow(this, thisPtr._validationRules);
            formRow.addListener(FormRow.AJAX_SUCCESS_EVENT, thisPtr, thisPtr._onAjaxSuccess);
        });
        $('.interactive_row').each(function(){
            var interactiveRow = new InteractiveRow(this);
            interactiveRow.addListener(FormRow.AJAX_SUCCESS_EVENT, thisPtr, thisPtr._onAjaxSuccess);
        });
    },

    _onAjaxSuccess: function(resp)
    {
        if (resp.error == "")
        {
            this._tableContainer.html(resp.content);
            this._initFormRows();
        }
        else
        {
            alert(resp.error);
        }
    }

});